package main

import (
    "fmt"
)

func main(){
    c := make(chan int)

    go func(){
        for i := 0; i < 5; i++{
            c <- i
        }

        //关闭channel
        close(c)
    }()

    //使用range迭代不断操作channel
    for data := range c {
        fmt.Println("data =",data)
    }

    fmt.Println("main Finished..")
}